package com.xiyan.base.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2020/11/24 8:57
 * Description: 基础实体类
 */
@Data
public class BaseEntity implements Serializable {

    @ApiModelProperty(value = "唯一标识")
    protected String id;

    @ApiModelProperty(value = "操作人ID")
    private String operatorUid;

    @ApiModelProperty(value = "操作人名称")
    private String operatorName;

    // 创建时自动填充时间
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    // 更新实体或者某个字段时自动填充更新时间
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    // 逻辑删除：在properties中
    @TableLogic
    @ApiModelProperty(value = "是否有效, 1 删除 0 未删除")
    private Integer deleted;

    //乐观锁处理并发操作
//    @Version
//    @ApiModelProperty(value = "版本号")
//    private Integer version;

}
